package org.nepu.srr.设备设施资料.消防设备设施证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;

@Data
public class B4aFireParams {
    @ApiModelProperty("消防泵")
    CommonIn firePump;

    @ApiModelProperty("消防栓、消防枪")
    CommonIn fireExtinguisher;

    @ApiModelProperty("消防软管")
    CommonIn fireWires;

    @ApiModelProperty("消防水雾灭火系统")
    CommonIn fireSmokeExtinguisher;

    @ApiModelProperty("移动式灭火器")
    CommonIn mobileExtinguisher;

    @ApiModelProperty("消防炮、泡沫炮")
    CommonIn firePistol;

    @ApiModelProperty("泡沐液")
    CommonIn foamLiquid;

    @ApiModelProperty("泡沫罐")
    CommonIn foamTank;

    @ApiModelProperty("喷淋系统")
    CommonIn spraySystem;

    @ApiModelProperty("消防服装")
    CommonIn fireClothing;

    @ApiModelProperty("防火门")
    CommonIn fireDoor;

    @ApiModelProperty("正压呼吸器")
    CommonIn pressureOxygenGenerator;

    @ApiModelProperty("应急逃生呼吸装置")
    CommonIn emergencyBreathingApparatus;

    public B4aFireResult rate(){
        double fullScore = 130;
        double score = 0;
        if(CommonMethods.isAllTrue(firePump.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fireExtinguisher.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fireWires.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fireSmokeExtinguisher.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(mobileExtinguisher.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(firePistol.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(foamLiquid.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(foamTank.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(spraySystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fireClothing.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fireDoor.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(pressureOxygenGenerator.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(emergencyBreathingApparatus.getInput())){
            score += 10;
        }
        double rate = score / fullScore;
        B4aFireResult result = new B4aFireResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
